package com.bili.bili_data_api.service.impl;

import com.bili.bili_data_api.dao.mapper.HuiyuanMapper;
import com.bili.bili_data_api.dao.pojo.Huiyuan;
import com.bili.bili_data_api.service.HuiyuanService;
import com.bili.bili_data_api.vo.Acopy;
import com.bili.bili_data_api.vo.HuiyuanVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class HuiyuanServiceImpl implements HuiyuanService {

    @Autowired
    private HuiyuanMapper huiyuanMapper;

    @Override
    public HuiyuanVo getCopy() {

        List<Huiyuan> huiyuanList = huiyuanMapper.selectList(null);
        HuiyuanVo huiyuanVo = new HuiyuanVo();
        List<Acopy> acopies = new ArrayList<>();
        for (Huiyuan huiyuan : huiyuanList) {
            Acopy acopy = new Acopy();
            acopy.setName(huiyuan.getStyle());
            acopy.setValue(Integer.toString(huiyuan.getNum()));
            acopies.add(acopy);
        }
        huiyuanVo.setAcopy(acopies);
        return huiyuanVo;
    }
}
